update-available [deprecated]
:no_entry: This package is deprecated in favour of update-notifier
and not maintained anymore.
Checks if there is an update available to your module or not, in other words, is the module is outdated or not.
Why?
Imagine you have a cli tool built with node, used by a lot of people. Then in one day you updated the tool and pushed to npm. You want users to be notified about the update.
You can burn this module into your app so that you can notify users that their version is outdated.
It's as simple as updateAvailable().then()
.
No arguments? No, no arguments.
install
npm install --save update-available
Usage
const updateAvailable = require('update-available');
updateAvailable()
.then(result => {
console.log(result);
})
.catch(err => {
});
- The
updateAvailable
function returns a Promise. - output
result
contains 3 fields:
updateAvailable
: true
if there is an update, false
if not.latestVersion
: latest version of the package published to the npm registry.currentVersion
: current version of the package installed.
- Check the
err
in .catch
to see if anything went wrong.
How it works?
- This package finds the
package.json
file of the host app. - Extracts
name
and version
fields from it. - Queries the npm registry to see the latest version of the app with
name
. - Compares the current version (obtained from
package.json
) with the latest version (obtained from npm registry). - Gives the result.
Change log
-
v1.0.1
- reducing package size by ignoring un-necessary files.
- docs update
-
v1.0.0
Licence
ISC © Vajahath Ahmed